/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.misena.praxispraktik.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author SENA
 */
@Entity
@Table(name = "empresarios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empresarios.findAll", query = "SELECT e FROM Empresarios e"),
    @NamedQuery(name = "Empresarios.findByIdEmpresarios", query = "SELECT e FROM Empresarios e WHERE e.idEmpresarios = :idEmpresarios")})
public class Empresarios implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idEmpresarios")
    private Integer idEmpresarios;
    @JoinColumn(name = "idPersonas", referencedColumnName = "idPersonas")
    @ManyToOne(optional = false)
    private Personas idPersonas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEmpresarios")
    private Collection<Empresas> empresasCollection;

    public Empresarios() {
    }

    public Empresarios(Integer idEmpresarios) {
        this.idEmpresarios = idEmpresarios;
    }

    public Integer getIdEmpresarios() {
        return idEmpresarios;
    }

    public void setIdEmpresarios(Integer idEmpresarios) {
        this.idEmpresarios = idEmpresarios;
    }

    public Personas getIdPersonas() {
        return idPersonas;
    }

    public void setIdPersonas(Personas idPersonas) {
        this.idPersonas = idPersonas;
    }

    @XmlTransient
    public Collection<Empresas> getEmpresasCollection() {
        return empresasCollection;
    }

    public void setEmpresasCollection(Collection<Empresas> empresasCollection) {
        this.empresasCollection = empresasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmpresarios != null ? idEmpresarios.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empresarios)) {
            return false;
        }
        Empresarios other = (Empresarios) object;
        if ((this.idEmpresarios == null && other.idEmpresarios != null) || (this.idEmpresarios != null && !this.idEmpresarios.equals(other.idEmpresarios))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.praxispraktik.entity.Empresarios[ idEmpresarios=" + idEmpresarios + " ]";
    }
    
}
